<?php

namespace App\Console;

use App\Jobs\Articles\Publish as ArticlesPublish;
use App\Jobs\TaskNotice\DailySign;
use App\Jobs\TaskNotice\ShareInvite;
use App\Jobs\Topic\Publish as TopicPublish;
use App\Jobs\Vip\CancelOrder;
use App\Jobs\Vip\Due;
use App\Jobs\Vip\Expire;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
    ];

    /**
     * Define the application's command schedule.
     *
     * @param \Illuminate\Console\Scheduling\Schedule $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // 每日签到提醒
        $schedule->job(new DailySign())->dailyAt('8:00');

        // 邀请注册任务提醒
        $schedule->job(new ShareInvite())->weeklyOn(1, '8:00');

        // vip即将到期发送服务消息
        $schedule->job(new Due())->dailyAt('8:30');

        // vip到期任务
        $schedule->job(new Expire())->everyMinute();

        // 取消未支付订单
        $schedule->job(new CancelOrder())->everyMinute();

        // 定时发布文章
        $schedule->job(new ArticlesPublish())->everyMinute();

        // 定时发布帖子
        $schedule->job(new TopicPublish())->everyMinute();
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__ . '/Commands');

        require base_path('routes/console.php');
    }
}
